package peer.rdpserver;

import peer.rdp.ConnectException;
import peer.rdp.Connection;
import peer.rdp.Tunnel;

public class ConnectionProcessor implements Runnable {
	Connection conn ;
	Thread t;
	public ConnectionProcessor(Connection conn ){
		this.conn=conn;
		conn.setConnectionProcessor(this);
		peer.Config.connectProcessorThreadPool.execute(this);
	}
	public void run() {
		try {
			if(!conn.isConnected()){
				conn.connect();
			}
			while(true){
				Tunnel tun=conn.accept();
				TunnelProcessor tp=new TunnelProcessor(tun);
				peer.Config.tunnelProcessorThreadPool.execute(tp);
			}
		} catch (ConnectException e1) {
			//e1.printStackTrace();
		} catch (Exception e) {
			//e.printStackTrace();
		}
	}
}
